<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>特维厂站维护</title>
		<link rel="stylesheet"
			href="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.css" />
		<link rel="stylesheet" href="/resources/bootstrap/css/bootstrap-datetimepicker.min.css" />
		<style>
			.red {
				background-color: #fca752
			}
			
			/* ------------------------- */
			
			.info-box .info-box-icon {
				font-size: 32px;
				font-style:italic;
			}
			.info-box p:nth-child(2) {
				font-size: x-large;
			}
			
			.info-box p:nth-child(1) {
				font-size: large;
			}
			.info-box-content{
			  padding:0;
			}
			.form-inline{
			  background-color:white;
			  padding:0px 10px;
			  font-size:16px;
			}
			 #year,#yearAnalysis,#finishStart,#finishEnd{
			  font-weight:bold;
			  margin:5px 0px;
			  font-size:16px;
			} 
			 #modelTraining .ui-widget{
			font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif;
			}    
			#unfinishedInfoDlgForm .ui-row-toggler{
			  margin:-6px;
			}
			.ui-tree{
			width:100%;
			}
			 .ui-state-highlight, .ui-widget-content .ui-state-highlight{
			  background: #8bb9d4;
			} 
			
			/* ------------------------- */
		</style>
	</ui:define>
	<ui:define name="content">
		<div class='full-center-content-scroll-noheader'>
		    <div class="nav-tabs-custom">
				<ul class="nav nav-tabs pull-left ">
					<li class="active"><a href="#modelTraining" id="deviceRelateTab"
						data-toggle="tab">特维厂站分析</a></li>
					<li><a href="#modelForcecast" data-toggle="tab">特维厂站查询</a></li>
				</ul>
				<div class="tab-content no-padding" >
				    <!-- 特维厂站查询 -->
					<div class="chart tab-pane" id="modelForcecast" style="position: relative;" >
							<div id="toolbarDiv" style="padding-right: 3px; height: 49px">
								<h:form id="headEditForm">
									<p:toolbar id="editToolbar" style="padding-left:15px;padding-right:15px;margin:5px">
										<f:facet name="left">
											<p:outputLabel value="特维年份:" style="margin-left:3px;margin-right:5px" />
											<input type="text" id="year" onchange="chaneYear();"
												style="width: 60px; margin-right: 10px; text-align: center" />
											<p:outputLabel value="电压等级:" style="margin-left:5px;margin-right:5px" />
											<h:selectOneMenu id="status" onchange="chaneYear()"
												value="#{specialMaintenanceStationController.voltage}"
												style="margin-right:10px;width:80px;height:28px">
												<f:selectItem itemLabel="220kV" itemValue="220" />
												<f:selectItem itemLabel="500kV" itemValue="500" />
											</h:selectOneMenu>
											<p:remoteCommand name="changeYear" oncomplete="getTableScrollHeight();"
												update="stationForm:tree :form:dataTb :functionForm:in_station"
												actionListener="#{specialMaintenanceStationController.changeYear}" />
											<p:commandButton value="新增特维厂站" style="margin-right:5px;"
												rendered="#{s:hasPermission(session,'bhyx_twczgl_xztwcz')}" 
												icon="ui-icon-plus"
												update="form:treeStation   form:treeStationDlg form:selectedSubstation form:startionSearch "
												actionListener="#{specialMaintenanceStationController.preSettingSubstation}"
												oncomplete="PF('treeStationDlg').show();getTableScrollHeight();" />
											<p:commandButton id="deleteStationButton" value="删除特维厂站" style="margin-right:5px;"
												disabled="#{specialMaintenanceStationController.selected == null}"
												rendered="#{s:hasPermission(session,'bhyx_twczgl_sctwcz')}"
												icon="ui-icon-trash"
												update="form:treeStation form:msgs form:dataTb :headEditForm:deleteStationButton stationForm:tree"
												actionListener="#{specialMaintenanceStationController.deleteBySubstation}" oncomplete="getTableScrollHeight();">
												<p:confirm header="提示" message="确定删除该特维厂站吗?" icon="ui-icon-alert" />
											</p:commandButton>
											<p:commandButton value="上传特维厂站" oncomplete="PF('stationFileUpload').show()"
												rendered="#{s:hasPermission(session,'bhyx_twczgl_shangchuantwcz')}"
												style="margin-right:5px;" icon="ui-icon-arrowthick-1-n" />
											<p:commandButton value="下载特维厂站模板" ajax="false" icon="ui-icon-arrowthick-1-s"
												style="margin-right:5px;"
												rendered="#{s:hasPermission(session,'bhyx_twczgl_xztwczmb')}"
												actionListener="#{specialMaintenanceStationController.downLoadStationTemplate()}">
												<p:fileDownload value="#{specialMaintenanceStationController.templateFile}" />
											</p:commandButton>
											<p:commandButton value="上传特维设备" oncomplete="PF('fileUpload').show()"
												rendered="#{s:hasPermission(session,'bhyx_twczgl_sctwsb')}" icon="ui-icon-arrowthick-1-n"
												style="margin-right:5px;">
												<p:confirm header="提示" message="上传文件会删除指定年份指定电压等级下的已有数据，确定上传吗?" icon="ui-icon-alert" />
											</p:commandButton>
											<p:commandButton value="下载特维设备模板" ajax="false" icon="ui-icon-arrowthick-1-s"
												style="margin-right:5px;"
												actionListener="#{specialMaintenanceStationController.fileDownloadView()}"
												rendered="#{s:hasPermission(session,'bhyx_twczgl_xztwsbmb')}">
												<p:fileDownload value="#{specialMaintenanceStationController.templateFile}" />
											</p:commandButton>
										</f:facet>
										<f:facet name="right">
											<p:commandButton value="未关联设备" update=":connForm:connDig"
												oncomplete="PF('connDig').show()"
												actionListener="#{specialMaintenanceStationController.unBind}" />
										</f:facet>
									</p:toolbar>
								</h:form>
								<!-- 未关联设备 -->
								<h:form id="connForm">
									<p:dialog widgetVar="connDig" header="详细信息" modal="true" id="connDig" width="1200"
										height="750">
										<p:toolbar>
											<f:facet name="left">
												<p:commandButton process="@this" id="bindBtn"
													disabled="#{specialMaintenanceStationController.selected == null}"
													rendered="#{s:hasPermission(session,'dwfxpg_ycsbpg_dlqyxfxpg_xztwsb')}"
													actionListener="#{specialMaintenanceStationController.getBreakerByPid()}"
													update=":form:detailDlg :form:editGrid" icon="ui-icon-pencil"
													oncomplete="PF('detailDlg').show()" value="编辑">
												</p:commandButton>
											</f:facet>
										</p:toolbar>
										<p:dataTable id="bindTab" widgetVar="bindTab"
											value="#{specialMaintenanceStationController.unBindStations}" var="device"
											rowKey="#{device.id}" emptyMessage="无记录" style="margin-bottom:20px;text-align:center"
											rows="10" rowIndexVar="ite" paginator="true" paginatorPosition="bottom"
											rowsPerPageTemplate="5,10,15" rowStyleClass="#{device.blankId == null ? 'red':null}"
											paginatorTemplate="{Customer} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
											<p:ajax event="rowSelectRadio" update="connForm:bindBtn"
												listener="#{specialMaintenanceStationController.rowSelection}" />
											<f:facet name="{Customer}">
												<p:outputLabel
													value="总计：#{specialMaintenanceStationController.unBindStations.size()}条纪录"
													style="margin-right:20px" />
											</f:facet>
											<p:column selectionMode="single" style="width:60px" />
											<p:column width="60" headerText="序号">
												<h:outputText value="#{ite+1}" />
											</p:column>
											<p:column headerText="调管机构">
												<h:outputText value="#{device.transMechanism}" />
											</p:column>
											<p:column headerText="运维分子公司">
												<h:outputText value="#{device.companyName}" />
											</p:column>
											<p:column headerText="运维单位">
												<h:outputText value="#{device.operationDepartment}" />
											</p:column>
											<p:column headerText="厂站" width="100">
												<h:outputText value="#{device.station}" />
											</p:column>
											<p:column headerText="间隔" width="140">
												<h:outputText value="#{device.blankName}" />
											</p:column>
											<p:column headerText="设备类型" width="140">
												<h:outputText value="#{device.equipmentType}" />
											</p:column>
											<p:column headerText="是否安排了停电计划" width="100">
												<h:outputText value="#{device.cutPowerPlan ? '是':'否'}" />
											</p:column>
											<p:column headerText="传动开始时间">
												<h:outputText value="#{device.chuandongTime}">
													<f:convertDateTime pattern="yyyy-MM-dd" />
												</h:outputText>
											</p:column>
											<p:column headerText="是否6月30日前应完成">
												<h:outputText value="#{device.finishBefore==true?'是':'否'}" />
											</p:column>
											<p:column headerText="是否已完成">
												<h:outputText value="#{device.finish==true?'是':'否'}" />
											</p:column>
											<p:column headerText="完成时间">
												<h:outputText value="#{device.finishedTime}">
													<f:convertDateTime pattern="yyyy-MM-dd" />
												</h:outputText>
											</p:column>
										</p:dataTable>
									</p:dialog>
								</h:form>
								<!-- 上传特维设备详细信息 -->
								<h:form id="fileForm">
									<p:remoteCommand name="updateVoltage" update="stationForm:tree :form:dataTb"
										actionListener="#{specialMaintenanceStationController.updateVoltage}" oncomplete="getTableScrollHeight();"/>
									<p:dialog header="上传文件" widgetVar="fileUpload" modal="true" id="fileUpload" width="700"
										height="200">
												选择上传年份
												<input type="text" id="updateYear" onchange="changeUpdateYear()"
											style="width: 60px; text-align: center" />
												电压等级
												<h:selectOneMenu id="updateVoltage" onchange="updateVoltage()"
											value="#{specialMaintenanceStationController.voltage}" style="width:80px;height:28px">
											<f:selectItem itemLabel="220kV" itemValue="220" />
											<f:selectItem itemLabel="500kV" itemValue="500" />
										</h:selectOneMenu>
												<p:selectBooleanCheckbox value="#{specialMaintenanceStationController.clearAll}"  itemLabel="清除原有数据">
													<p:ajax update="fileUploadFile1" />
									        	</p:selectBooleanCheckbox>
										<p:remoteCommand name="updateYear"
											actionListener="#{specialMaintenanceStationController.updateYear()}" />
										<p:fileUpload id="fileUploadFile1" style="margin-top:10px" cancelLabel="取消" sizeLimit="1000000" fileLimit="3"
											mode="advanced" dragDropSupport="false" allowTypes="/(\.|\/)(xlsx)$/"
											oncomplete="PF('fileUpload').hide()" update=":form:msgs :stationForm:tree"
											fileUploadListener="#{specialMaintenanceStationController.handleFileUpload}"
											uploadLabel="上传" label="文件" >
												<f:attribute name="isclear" value="#{specialMaintenanceStationController.clearAll}" />
											</p:fileUpload>
									</p:dialog>
								</h:form>
								<!-- 上传特维厂站 -->
								<h:form>
									<p:dialog header="上传文件" widgetVar="stationFileUpload" modal="true" id="stationFileUpload"
										width="700" height="200">
												选择上传年份
												<input type="text" id="stationUpdateYear" onchange="changeStationUploadYear()"
											style="width: 60px; text-align: center" />
										<p:remoteCommand name="stationUpdateYear"
											actionListener="#{specialMaintenanceStationController.updateYear()}" />
										<p:fileUpload style="margin-top:10px" cancelLabel="取消" sizeLimit="1000000" fileLimit="3"
											mode="advanced" dragDropSupport="false" allowTypes="/(\.|\/)(xlsx)$/"
											oncomplete="PF('stationFileUpload').hide()" update=":form:msgs :stationForm:tree"
											fileUploadListener="#{specialMaintenanceStationController.handleStationFile}"
											uploadLabel="上传" label="文件" />
									</p:dialog>
								</h:form>
							</div>
							<div class="col-md-2" style="padding-right: 3px" >
								<div class="box-header with-border" style="padding: 19px">
									<h:form id="functionForm">
										<p:autoComplete placeholder="输入首字母查询" id="in_station" size="15"
											value="#{specialMaintenanceStationController.filterStation}"
											completeMethod="#{specialMaintenanceStationController.completeSpStation}"
											scrollHeight="400" dropdown="true">
											<p:ajax update="in_station stationForm:tree" event="itemSelect"
												listener="#{specialMaintenanceStationController.autoCompleteStation}" />
										</p:autoComplete>
										<p:commandButton icon="fa fa-refresh" style="margin-left: 3px; width:40px;height:30px"
											update="stationForm:tree in_station"
											actionListener="#{specialMaintenanceStationController.refresh()}">
										</p:commandButton>
									</h:form>
								</div>
								<div class="box-body">
									<h:form id="stationForm">
										<p:tree value="#{specialMaintenanceStationController.root}" style="border:none;width:215px"
											selectionMode="single" var="node" dynamic="true" id="tree" widgetVar="tree" animate="true">
											<p:ajax event="select" process="@this" update="form:dataTb form:export_id :headEditForm:deleteStationButton" 
												listener="#{specialMaintenanceStationController.onNodeSelect}" oncomplete="getTableScrollHeight();"/>
											<p:treeNode type="root" icon="fa fa-home">
												<h:outputText value="#{node}" />
											</p:treeNode>
											<p:treeNode type="dept" icon="fa fa-home ">
												<h:outputText value="#{node}" />
											</p:treeNode>
											<p:treeNode type="MaintenanceStation">
												<h:outputText value="#{node.station}" />
											</p:treeNode>
										</p:tree>
									</h:form>
								</div>
							</div>
							<div class="col-md-10 " style="padding-left: 3px">
									<div class="box-body">
										<h:form id="form">
											<p:toolbar id="toolbar">
												<f:facet name="left">
													<p:commandButton id="newDeviceBtn" value="新增间隔"
														rendered="#{s:hasPermission(session,'bhyx_twczgl_xz')}" icon="ui-icon-plus"
														disabled="#{specialMaintenanceStationController.selected == null}"
														style="margin-right:5px;" update="form:createDevice form:saveDeviceBtn"
														actionListener="#{specialMaintenanceStationController.createNewDevice}"
														oncomplete="PF('createDeviceDlg').show()" />
													<p:commandButton process="@this" id="editBtn" style="margin-right:5px;"
														disabled="#{specialMaintenanceStationController.selected == null}"
														rendered="#{s:hasPermission(session,'bhyx_twczgl_bj')}"
														actionListener="#{specialMaintenanceStationController.getBreakerByPid()}"
														update="detailDlg editGrid" icon="ui-icon-pencil" oncomplete="PF('detailDlg').show()"
														value="编辑" />
													<p:commandButton disabled="#{specialMaintenanceStationController.selected == null}"
														update=":form:dataTb :form:msgs stationForm:tree form:toolbar"
														id="delBtn" icon="ui-icon-trash" value="删除" style="margin-right:5px;"
														actionListener="#{specialMaintenanceStationController.deleteDevice}"
														rendered="#{s:hasPermission(session,'bhyx_twczgl_sc')}" oncomplete="getTableScrollHeight();">
														<p:confirm headder="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
													</p:commandButton>
													<p:commandButton id="auditButton"  value="日志记录"  icon="ui-icon-document"  
													     disabled="#{specialMaintenanceStationController.selected == null}"
														 oncomplete="PF('dataDlg').show()" update="logForm:dataTable logForm" 
														 actionListener="#{specialMaintenanceStationController.initAuditLog}">
													</p:commandButton>
													<p:commandButton value="导出" icon="ui-icon-document" id="export_id"
														rendered="#{s:hasPermission(session,'bhyx_twczgl_dc')}"
														disabled="#{specialMaintenanceStationController.currentSelect==null}"
														actionListener="#{specialMaintenanceStationController.exportRecords()}" ajax="false"
														style="margin-right:5px;">
														<p:fileDownload value="#{specialMaintenanceStationController.exportFile}" />
													</p:commandButton>
												</f:facet>
												<f:facet name="right">
													<p:selectBooleanCheckbox value="#{specialMaintenanceStationController.showAllColumns}"
														itemLabel="显示全部">
														<p:ajax event="change" process="@this" update="form:dataTb" oncomplete="getTableScrollHeight();"></p:ajax>
													</p:selectBooleanCheckbox>
												</f:facet>
											</p:toolbar>
											<p:growl id="msgs" showDetail="true" />
											<p:dataTable id="dataTb" var="device" rowKey="#{device.id}" emptyMessage="无记录"
												value="#{specialMaintenanceStationController.specialStation}" selectionMode="single"
												style="margin-bottom:20px;text-align:center" rows="20" paginator="true"
												paginatorPosition="bottom"
												paginatorTemplate="{Customer} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
											    scrollable="true">
												<p:ajax  event="rowSelect" update=":form:editBtn   :form:auditButton :form:newDeviceBtn  :form:delBtn 
												:headEditForm:deleteStationButton    updateSp "
													listener="#{specialMaintenanceStationController.rowSelection}"></p:ajax>
												<f:facet name="{Customer}">
													<p:outputLabel value="总计：#{specialMaintenanceStationController.specialStation.size()}条纪录"
														style="margin-right:20px" />
												</f:facet>
												<p:column groupRow="true" headerText="厂站" width="50">
													<h:outputText value="#{device.station}" />
												</p:column>
												<p:column groupRow="true" headerText="运维单位" width="60">
													<h:outputText value="#{device.operationDepartment}" />
												</p:column>
												<p:column  headerText="运维分子公司" width="50"
													rendered="#{specialMaintenanceStationController.showAllColumns}">
													<h:outputText value="#{device.companyName}" />
												</p:column>
												<p:column headerText="间隔" width="50" >
													<h:outputText value="#{device.blankName}" />
												</p:column>
												<p:column headerText="是否安排了停电计划" width="50"
													rendered="#{specialMaintenanceStationController.showAllColumns}">
													<h:outputText value="#{device.cutPowerPlan ? '是':'否'}" />
												</p:column>
												<p:column headerText="是否具备不停电传动功能" width="60"
													rendered="#{specialMaintenanceStationController.showAllColumns}">
													<h:outputText value="#{device.transmit}" />
												</p:column>
												<!-- <p:column headerText="是否6月30日前应完成" width="30"
													rendered="#{specialMaintenanceStationController.showAllColumns}">
													<h:outputText value="#{device.finishBefore==true?'是':'否'}" />
												</p:column> -->
												<p:column headerText="是否6月30日前已完成" width="60"
													rendered="#{specialMaintenanceStationController.showAllColumns}">
													<h:outputText value="#{device.finish==true?'是':'否'}" />
												</p:column>
												<p:column headerText="A相" width="80">
													<p:outputLabel value="#{device.phaseALastFault}" style="color:green" rendered="#{device.phaseALastFault.contains('传动')}" />
													<p:outputLabel value="#{device.phaseALastFault}" style="color:red" rendered="#{device.phaseALastFault.contains('单')}" />
												</p:column>
												<p:column headerText="B相" width="80">
													<p:outputLabel value="#{device.phaseBLastFault}" style="color:green" rendered="#{device.phaseBLastFault.contains('传动')}" />
													<p:outputLabel value="#{device.phaseBLastFault}" style="color:red" rendered="#{device.phaseBLastFault.contains('单')}" />
												</p:column>
												<p:column headerText="C相" width="80">
													<p:outputLabel value="#{device.phaseCLastFault}" style="color:green" rendered="#{device.phaseCLastFault.contains('传动')}" />
													<p:outputLabel value="#{device.phaseCLastFault}" style="color:red" rendered="#{device.phaseCLastFault.contains('单')}"/>
												</p:column>
												<p:column headerText="计划传动日期" width="60">
													<h:outputText value="#{specialMaintenanceStationController.showPlanTime(device)}" />
												</p:column>
												<p:column headerText="传动完成日期" width="60">
											    	<p:commandLink  title="检修内容"
														actionListener="#{specialMaintenanceStationController.showMaintenanceLog(device)}"
														oncomplete="PF('maintenanceLogDialog').show()"  update="form:maintenanceLogDialog">
													<h:outputText value="#{device.finishedTime}">
														<f:convertDateTime pattern="yyyy-MM-dd" />
													</h:outputText>
													</p:commandLink>
												</p:column>
												<p:column headerText="创建人" width="40">
													<p:outputLabel value="#{device.creator}"/>
												</p:column>
												<p:column headerText="操作" width="40">
													<p:commandLink id="updateSp" style="color: red; margin-left:10px;" title="更新特维站"
														styleClass="ui-commandlink ui-widget fa fa-refresh"
														actionListener="#{specialMaintenanceStationController.preUpdateEquipment(device)}"
														update="form:dataTb" oncomplete="getTableScrollHeight();" />
												</p:column>
											</p:dataTable>
											<!-- 特维站点分析 -->
												<p:dialog id="maintenanceLogDialog" widgetVar="maintenanceLogDialog"     header="检修内容"
												modal="true" width="450" height="150">
											     <h:outputText  id="content"  value="#{specialMaintenanceStationController.content} " style="white-space:pre-wrap;" escape="false" />
											</p:dialog>
											<!-- 删除确认框 -->
											<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
												<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes"
													icon="ui-icon-check" />
												<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no"
													icon="ui-icon-close" />
											</p:confirmDialog>
											<!-- 详细信息 -->
											<p:dialog widgetVar="detailDlg" header="详细信息" modal="true" id="detailDlg" width="950" height="700">
												<p:toolbar>
													<f:facet name="left">
														<p:commandButton id="editSaveBtn" value="保存" icon="ui-icon-disk"
															update="form:dataTb :connForm:bindTab form:msgs form stationForm:tree"
															oncomplete="PF('detailDlg').hide();getTableScrollHeight();"
															actionListener="#{specialMaintenanceStationController.update}" />
													</f:facet>
													
													<f:facet name="right"  >
														<p:selectBooleanCheckbox  style="float: right;margin-top:7px;" 
														 value= "#{specialMaintenanceStationController.changeStationLedger}" 
														  itemLabel="关联维护变电站信息"/>
													</f:facet>
													
												</p:toolbar>
												<p:outputPanel id="editDetail" style="text-align:center;">
													<p:panelGrid columns="4" id="editGrid"
														rendered="#{not empty specialMaintenanceStationController.selected}">
														<h:outputText value="厂站" />
														<p:column>
															<p:inputText id="stationId"
																value="#{specialMaintenanceStationController.selected.station}" readonly="true" />
															<p:commandButton value="选择" style="margin-left:5px"
																disabled="#{specialMaintenanceStationController.selected.station != null}"
																actionListener="#{ledgerQueryDataController.getSubstaionSelectDialog()}">
																<p:ajax event="dialogReturn"
																	listener="#{specialMaintenanceStationController.onSubstationChosen}"
																	update="stationId dispatchUnitId dispatchUnitBtn companyId companyBtn operationDepartmentId operationDepartmentBtn" />
															</p:commandButton>
														</p:column>
			
														<h:outputText value="调管单位" />
														<p:column style="text-align:left">
															<p:inputText id="dispatchUnitId"  
																value="#{specialMaintenanceStationController.selected.transMechanism}" readonly="false" />
															<p:commandButton value="选择" style="margin-left:5px" id="dispatchUnitBtn"
																
																actionListener="#{ledgerQueryDataController.getDesorgDepartDialog()}">
																<!--disabled="#{specialMaintenanceStationController.selected.station != null}"  -->
																<p:ajax event="dialogReturn"
																	listener="#{specialMaintenanceStationController.onDispatchUnitChosen}"
																	update="dispatchUnitId" />
															</p:commandButton>
														</p:column>
			
														<h:outputText value="运维分子公司" />
														<p:column>
															<p:inputText id="companyId"
																value="#{specialMaintenanceStationController.selected.companyName}" readonly="true" />
															<p:commandButton value="选择" style="margin-left:5px" id="companyBtn"
																actionListener="#{ledgerQueryDataController.getOpDepartDialog()}"
																disabled="#{specialMaintenanceStationController.selected.station != null}">
																<p:ajax event="dialogReturn"
																	listener="#{specialMaintenanceStationController.onCompanyChosen}" update="companyId" />
															</p:commandButton>
														</p:column>
			
														<h:outputText value="运维单位" />
														<p:column style="text-align:left">
															<p:inputText id="operationDepartmentId"
																value="#{specialMaintenanceStationController.selected.operationDepartment}"
																readonly="true" />
															<p:commandButton value="选择" style="margin-left:5px" id="operationDepartmentBtn"
																disabled="#{specialMaintenanceStationController.selected.station != null}"
																actionListener="#{ledgerQueryDataController.getOpDepartDialog()}">
																<p:ajax event="dialogReturn"
																	listener="#{specialMaintenanceStationController.onMaintenanceUnitChosen}"
																	update="operationDepartmentId" />
															</p:commandButton>
														</p:column>
			
														<h:outputText value="防范故障类型" />
														<p:inputText style="width:99%"
															value="#{specialMaintenanceStationController.selected.faultType}" />
			
														<h:outputText value="间隔名称" />
														<p:column>
															<p:inputText id="blankName"
																value="#{specialMaintenanceStationController.selected.blankName}" />
															<p:commandButton value="关联" style="margin-left:5px"
																actionListener="#{specialMaintenanceStationController.getEquipmentByStation()}">
																<p:ajax event="dialogReturn"
																	listener="#{specialMaintenanceStationController.onAnologSelectorChosen}"
																	update="blankName breakerTb equimentType" />
															</p:commandButton>
														</p:column>
			
														<h:outputText value="设备类型" />
														<p:selectOneMenu id="equimentType"
															value="#{specialMaintenanceStationController.selected.equipmentType}" style="width:100%">
															<f:selectItem itemLabel="主变" itemValue="主变" />
															<f:selectItem itemLabel="线路" itemValue="线路" />
															<f:selectItem itemLabel="母线" itemValue="母线" />
															<f:selectItem itemLabel="其他" itemValue="其他" />
														</p:selectOneMenu>
														<h:outputText value="是否安排了停电计划" />
														<p:selectOneMenu style="width:100%"
															value="#{specialMaintenanceStationController.selected.cutPowerPlan}">
															<f:selectItem itemLabel="是" itemValue="true" />
															<f:selectItem itemLabel="否" itemValue="false" />
														</p:selectOneMenu>
														<h:outputText value="传动计划时间" />
															<p:calendar value="#{specialMaintenanceStationController.selected.chuandongTime}"
																pattern="yyyy-MM-dd">
															</p:calendar>
														<h:outputText value="是否6月30日前已完成" />
														<p:selectOneMenu style="width:100%"
															value="#{specialMaintenanceStationController.selected.finish}">
															<f:selectItem itemLabel="是" itemValue="true" />
															<f:selectItem itemLabel="否" itemValue="false" />
														</p:selectOneMenu>
														<h:outputText value="传动日期" />
														<p:calendar value="#{specialMaintenanceStationController.selected.finishedTime}"
															pattern="yyyy-MM-dd">
														</p:calendar>
			
														<h:outputText value="是否具备不停电传动功能" />
														<p:selectOneMenu style="width:100%"
															value="#{specialMaintenanceStationController.selected.transmit}">
															<f:selectItem itemLabel="是" itemValue="是" />
															<f:selectItem itemLabel="否" itemValue="否" />
															<f:selectItem itemLabel="不具备" itemValue="不具备" />
														</p:selectOneMenu>
													</p:panelGrid>
			
													<p:panelGrid rendered="#{not empty specialMaintenanceStationController.selected}"
														style="width:100%" columns="1">
														<h:outputText value="备注" />
														<p:column>
															<h:inputTextarea rows="4" style="width:100%"
																value="#{specialMaintenanceStationController.selected.remark}" />
														</p:column>
													</p:panelGrid>
			
													<p:outputPanel>
														<h4>开关跳闸信息</h4>
													</p:outputPanel>
													<p:dataTable id="breakerTb" var="breaker" emptyMessage="无记录" rowKey="#{breaker.id}"
														editable="true" editMode="cell"
														value="#{specialMaintenanceStationController.specialBreaker}" style="margin-bottom:20px"
														rows="15">
														<p:column headerText="开关名称">
															<h:outputText value="#{breaker.name}" />
														</p:column>
														<p:column headerText="A相">
															<p:cellEditor>
																<f:facet name="output">
																	<p:calendar value="#{breaker.lastTripATime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</f:facet>
																<f:facet name="input">
																	<p:calendar value="#{breaker.lastTripATime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</f:facet>
															</p:cellEditor>
														</p:column>
														<p:column headerText="B相">
															<p:cellEditor>
																<f:facet name="output">
																	<p:calendar value="#{breaker.lastTripBTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</f:facet>
																<f:facet name="input">
																	<p:calendar value="#{breaker.lastTripBTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</f:facet>
															</p:cellEditor>
														</p:column>
														<p:column headerText="C相">
															<p:cellEditor>
																<f:facet name="output">
																	<p:calendar value="#{breaker.lastTripCTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</f:facet>
																<f:facet name="input">
																	<p:calendar value="#{breaker.lastTripCTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</f:facet>
															</p:cellEditor>
														</p:column>
													</p:dataTable>
												</p:outputPanel>
											</p:dialog>
											<!-- 变电站dialog -->
											<p:dialog id="treeStationDlg" widgetVar="treeStationDlg" header="新增特维厂站" modal="true"
												width="830" height="500">
												<p:toolbar>
													<f:facet name="left">
														<p:autoComplete id="startionSearch" dropdown="true" placeholder="变电站首字母查询"
															scrollHeight="400" style="margin-right:10px"
															rendered="#{s:hasPermission(session,'jcsj_sjwh_twczxx_bdzjs')}"
															value="#{specialMaintenanceStationController.stationSearch}"
															completeMethod="#{stationDataViewController.complateStation}">
															<p:ajax update="treeStation selectedSubstation" event="itemSelect"
																listener="#{specialMaintenanceStationController.searchBySubstation()}" />
														</p:autoComplete>
														<p:commandButton value="重置" icon="ui-icon-refresh"
															rendered="#{s:hasPermission(session,'jcsj_sjwh_twczxx_bdzzz')}"
															actionListener="#{specialMaintenanceStationController.resetSubstation()}"
															update="startionSearch treeStation" />
														<p:commandButton value="保存"
															actionListener="#{specialMaintenanceStationController.preSubstationSave}"
															rendered="#{s:hasPermission(session,'jcsj_sjwh_twczxx_bdzbc')}"
															update=" stationForm:tree msgs overrideConfirmForm:overrideConfirmDialog " oncomplete="PF('treeStationDlg').hide()">
														</p:commandButton>
													</f:facet>
												</p:toolbar>
												<div class="col-sm-12">
													<div class="col-sm-6">
														<p:tree id="treeStation" widgetVar="treeStation"
															value="#{specialMaintenanceStationController.stationRoot}" var="node" dynamic="true"
															animate="true" selectionMode="checkbox" style="border:0"
															selection="#{specialMaintenanceStationController.selectedStation}">
															<p:treeNode type="voltage" icon="fa fa-home">
																<h:outputText value="#{node}" />
															</p:treeNode>
															<p:treeNode type="substation" icon="fa fa-user">
																<h:outputText value="#{node}" />
															</p:treeNode>
														</p:tree>
													</div>
													<div class="col-sm-6">
														<p:dataList id="selectedSubstation" widgetVar="selectedSubstation" emptyMessage="暂无记录。"
															value="#{specialMaintenanceStationController.selectedList}" var="sub" type="ordered">
															#{sub.name}
														</p:dataList>
													</div>
												</div>
											</p:dialog>
											<!-- 新增设备  -->
											<p:dialog widgetVar="createDeviceDlg" header="新增特维设备" modal="true" id="createDeviceDlg"
												width="900" height="500">
												<p:toolbar>
													<f:facet name="left">
														<p:commandButton id="saveDeviceBtn" value="保存" icon="ui-icon-disk"
															update="form:dataTb  form:msgs :stationForm:tree"
															oncomplete="PF('createDeviceDlg').hide(); getTableScrollHeight();"
															actionListener="#{specialMaintenanceStationController.saveNewDevice}" />
													</f:facet>
												</p:toolbar>
												<p:outputPanel id="createDevice" style="text-align:center;">
													<p:panelGrid rendered="#{not empty specialMaintenanceStationController.created}">
														<p:row>
															<p:column>
																<h:outputText value="厂站" />
															</p:column>
															<p:column>
																<p:inputText id="station_id"
																	value="#{specialMaintenanceStationController.created.station}" readonly="true" />
																<p:commandButton value="选择" style="margin-left:5px" disabled="true"
																	actionListener="#{ledgerQueryDataController.getSubstaionSelectDialog()}">
																	<p:ajax event="dialogReturn"
																		listener="#{specialMaintenanceStationController.onSubstationChosen}"
																		update="station_id dispatchUnit_id dispatchUnit_btn company_id company_btn operationDepartment_id operationDepartment_btn" />
																</p:commandButton>
															</p:column>
															<p:column>
																<h:outputText value="调管单位" />
															</p:column>
															<p:column style="text-align:left">
																<p:inputText id="dispatchUnit_id"
																	value="#{specialMaintenanceStationController.created.transMechanism}" readonly="true" />
																<p:commandButton value="选择" style="margin-left:5px" id="dispatchUnit_btn"  
															    	disabled="true"
																	actionListener="#{ledgerQueryDataController.getDesorgDepartDialog()}">
																	<p:ajax event="dialogReturn"
																		listener="#{specialMaintenanceStationController.onDispatchUnitChosen}"
																		update="dispatchUnit_id" />
																</p:commandButton>
															</p:column>
														</p:row>
														<p:row>
															<p:column>
																<h:outputText value="运维分子公司" />
															</p:column>
															<p:column>
																<p:inputText id="company_id"
																	value="#{specialMaintenanceStationController.created.companyName}" />
																<p:commandButton value="选择" style="margin-left:5px" id="company_btn"
																	actionListener="#{ledgerQueryDataController.getOpDepartDialog()}"
																	disabled="true">
																	<p:ajax event="dialogReturn"
																		listener="#{specialMaintenanceStationController.onCompanyChosen}" update="company_id" />
																</p:commandButton>
															</p:column>
															<p:column>
																<h:outputText value="运维单位" />
															</p:column>
															<p:column style="text-align:left">
																<p:inputText id="operationDepartment_id"
																	value="#{specialMaintenanceStationController.created.operationDepartment}"
																	readonly="true" />
																<p:commandButton value="选择" style="margin-left:5px" id="operationDepartment_btn"
																	disabled="true"
																	actionListener="#{ledgerQueryDataController.getOpDepartDialog()}">
																	<p:ajax event="dialogReturn"
																		listener="#{specialMaintenanceStationController.onMaintenanceUnitChosen}"
																		update="operationDepartment_id" />
																</p:commandButton>
															</p:column>
														</p:row>
														<p:row>
															<p:column>
																<h:outputText value="防范故障类型" />
															</p:column>
															<p:column style="text-align:left">
																<p:inputText label="faultType"
																	value="#{specialMaintenanceStationController.created.faultType}" />
															</p:column>
															<p:column>
																<h:outputText value="间隔名称" />
															</p:column>
															<p:column>
																<p:inputText id="bn" value="#{specialMaintenanceStationController.created.blankName}" />
																<p:commandButton style="margin-left:5px" value="关联"
																	actionListener="#{specialMaintenanceStationController.selectEquipmentByStation()}">
																	<p:ajax event="dialogReturn"
																		listener="#{specialMaintenanceStationController.onGetEquipment}" update="bn" />
																</p:commandButton>
															</p:column>
														</p:row>
														<p:row>
															<p:column>
																<h:outputText value="设备类型" />
															</p:column>
															<p:column style="text-align:left">
																<p:selectOneMenu value="#{specialMaintenanceStationController.created.equipmentType}"
																	style="width:70%">
																	<f:selectItem itemLabel="主变" itemValue="主变" />
																	<f:selectItem itemLabel="线路" itemValue="线路" />
																	<f:selectItem itemLabel="母线" itemValue="母线" />
																	<f:selectItem itemLabel="其他" itemValue="其他" />
																</p:selectOneMenu>
															</p:column>
															<p:column>
																<h:outputText value="是否安排了停电计划" />
															</p:column>
															<p:column style="text-align:left">
																<p:selectOneMenu value="#{specialMaintenanceStationController.created.cutPowerPlan}"
																	style="width:70%">
																	<f:selectItem itemLabel="是" itemValue="true" />
																	<f:selectItem itemLabel="否" itemValue="false" />
																</p:selectOneMenu>
															</p:column>
														</p:row>
														<p:row>
															<p:column>
																<h:outputText value="是否6月30日前已完成" />
															</p:column>
															<p:column style="text-align:left">
																<p:selectOneMenu value="#{specialMaintenanceStationController.created.finish}"
																	style="width:70%">
																	<f:selectItem itemLabel="是" itemValue="true" />
																	<f:selectItem itemLabel="否" itemValue="false" />
																</p:selectOneMenu>
															</p:column>
															<p:column>
																<h:outputText value="是否具备不停电传动功能" />
															</p:column>
															<p:column style="text-align:left">
																<p:selectOneMenu value="#{specialMaintenanceStationController.created.transmit}"
																	style="width:70%">
																	<f:selectItem itemLabel="是" itemValue="是" />
																	<f:selectItem itemLabel="否" itemValue="否" />
																	<f:selectItem itemLabel="不具备" itemValue="不具备" />
																</p:selectOneMenu>
															</p:column>
														</p:row>
														<p:row>
															<p:column>
																<h:outputText value="传动计划时间" />
															</p:column>
															<p:column style="text-align:left">
																<p:calendar mask="true"
																	value="#{specialMaintenanceStationController.created.chuandongTime}"
																	pattern="yyyy-MM-dd" />
															</p:column>
															<p:column>
																<h:outputText value="已完成时间" />
															</p:column>
															<p:column style="text-align:left">
																<p:calendar mask="true"
																	value="#{specialMaintenanceStationController.created.finishedTime}"
																	pattern="yyyy-MM-dd" />
															</p:column>
														</p:row>
													</p:panelGrid>
													<p:panelGrid rendered="#{not empty specialMaintenanceStationController.created}"
														style="width:100%" columns="1">
														<h:outputText value="备注" />
														<p:column>
															<h:inputTextarea rows="4" style="width:100%"
																value="#{specialMaintenanceStationController.created.remark}" />
														</p:column>
													</p:panelGrid>
												</p:outputPanel>
											</p:dialog>
										</h:form>
										<!--日志记录  -->
										<p:dialog widgetVar="dataDlg" header="日志记录" modal="true" id="dataDlg"
												width="1400" height="700" onHide="initDatas()">
												<h:form id="logForm">
													<div class="box box-solid with-border">
														<div class="box-header">
															<p:outputLabel for="popup7" value="故障时间：" />
															<p:calendar id="popup7" navigator="true" value="#{specialMaintenanceStationController.logQueryStartDate}"
																pattern="yyyy-MM-dd" maxdate="Date()" size="12">
																<p:ajax event="dateSelect" listener="#{faultReportController.onDateSelectStart}" />
															</p:calendar>
															<p:outputLabel for="popup8" value="至 " style="margin-right:5px;margin-left:5px;" />
															<p:calendar id="popup8" navigator="true" value="#{specialMaintenanceStationController.logQueryEndDate}"
																pattern="yyyy-MM-dd" maxdate="Date()" size="12">
																<p:ajax event="dateSelect" listener="#{faultReportController.onDateSelectEnd}" />
															</p:calendar>
															<p:selectBooleanCheckbox  id="currenDevice" style="margin-top:7px;margin-left:7px;color:blue;"
																 value= "#{specialMaintenanceStationController.queryCurrentDevice}" 
																  itemLabel="根据当前间隔"/>
															<p:commandButton value="查询" icon="ui-icon-search"
																style="margin-left:10px"
																actionListener="#{specialMaintenanceStationController.queryAuditLogByCondition}"
																update="logForm:dataTable" />
															<p:commandButton value="重置" icon="ui-icon-refresh"
																style="margin-right:10px"
																actionListener="#{specialMaintenanceStationController.resetAuditLog}"
																update="logForm:dataTable logForm:popup8 logForm:popup7  logForm:currenDevice" />
														</div>
													</div>
													<p:dataTable value="#{specialMaintenanceStationController.auditLog}"
														var="act" paginator="true" id="dataTable" emptyMessage="无记录"
														rowKey="#{act.id}" rows="20" rowIndexVar="ite"
														paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
														rowsPerPageTemplate="20,50,100" paginatorPosition="bottom"
														style="text-align:center;margin-top:3px">
														<f:facet name="{Customization}">
															<p:outputLabel value="总计：#{specialMaintenanceStationController.auditLog.size()} 条记录" style="margin-right:20px;" />
														</f:facet>
														<p:column width="60" headerText="序号">
															<h:outputText value="#{ite+1}" />
														</p:column>
														<p:column headerText="功能名称"   width="150">
															<p:outputLabel value="#{act.functionName}" />
														</p:column>
														<p:column headerText="操作类型">
															<p:outputLabel value="#{specialMaintenanceStationController.getOperateType(act.optype)}" />
														</p:column>
														<p:column headerText="操作时间">
															<p:outputLabel value="#{act.operationDate}" />
														</p:column>
														<p:column headerText="操作人">
															<p:outputLabel value="#{act.userCode}" />
														</p:column>
														<p:column headerText="操作人所在部门">
															<p:outputLabel value="#{act.dept}" />
														</p:column>
														<p:column headerText="数据变化对比">
												         <p:commandButton update=" preValueDigForm " actionListener="#{specialMaintenanceStationController.valueCompare(act)}" 
												          oncomplete="PF('preValueDig').show()"  icon="ui-icon-search" style="margin:0 auto;color:red"/>
														</p:column>
													</p:dataTable>
												</h:form>
											</p:dialog>
										<!-- 值对比 -->
										<h:form id="preValueDigForm">
										   <p:dialog  id="preValueDig" widgetVar="preValueDig" width="700" height="700" modal="true"  >
										  <div class="row" style="width: 102%; padding-top: 15px;">
											<div class="col-xs-12">
												<h4 align="left">变化对比</h4>
													<div class="box box-primary">
														<div class="box-body">
														<p:panelGrid rendered="#{specialMaintenanceStationController.renderComparePanel}" align="center"  
															styleClass="ui-noborder" border="0px" width="700">
															<p:row>
																<p:column>
																	<p:outputLabel value=" " />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:outputLabel value="原始值" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:outputLabel value="新增值" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="厂站：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.station}" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.station}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="运维单位：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.operationDepartment}" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.operationDepartment}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="调管单位：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.transMechanism}" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.transMechanism}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column >
																	<p:outputLabel value="设备类型：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.equipmentType}" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.equipmentType}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="间隔名称：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.blankName}" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.blankName}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="是否安排停电计划：" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:selectOneMenu style="width:100%"
																		value="#{specialMaintenanceStationController.oldmS.cutPowerPlan}">
																		<f:selectItem itemLabel="是" itemValue="true" />
																		<f:selectItem itemLabel="否" itemValue="false" />
																	</p:selectOneMenu>
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																     <p:selectOneMenu style="width:100%"
																		value="#{specialMaintenanceStationController.newmS.cutPowerPlan}">
																		<f:selectItem itemLabel="是" itemValue="true" />
																		<f:selectItem itemLabel="否" itemValue="false" />
																	</p:selectOneMenu>
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="是否具备不停电传动功能：" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.transmit}" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.transmit}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="是否6月30日前完成：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																      <p:selectOneMenu style="width:100%"
																		value="#{specialMaintenanceStationController.oldmS.finishBefore}">
																		<f:selectItem itemLabel="是" itemValue="true" />
																		<f:selectItem itemLabel="否" itemValue="false" />
																	</p:selectOneMenu>
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.newmS.id != null}">
																     <p:selectOneMenu style="width:100%"
																		value="#{specialMaintenanceStationController.newmS.finishBefore}">
																		<f:selectItem itemLabel="是" itemValue="true" />
																		<f:selectItem itemLabel="否" itemValue="false" />
																	</p:selectOneMenu>
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="A相：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.phaseALastFault}" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.phaseALastFault}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="B相：" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.phaseBLastFault}" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.phaseBLastFault}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="C相：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.phaseCLastFault}" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.phaseCLastFault}" />
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="计划传动日期：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																 <p:calendar value="#{specialMaintenanceStationController.oldmS.chuandongTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																   <p:calendar value="#{specialMaintenanceStationController.newmS.chuandongTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="传动完成日期：" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																 <p:calendar value="#{specialMaintenanceStationController.oldmS.finishedTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																 <p:calendar value="#{specialMaintenanceStationController.newmS.finishedTime}" pattern="yyyy-MM-dd HH:mm:ss">
																	</p:calendar>
																</p:column>
															</p:row>
															<p:row>
																<p:column>
																	<p:outputLabel value="创建人：" />
																</p:column>
																<p:column rendered="#{specialMaintenanceStationController.oldmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.oldmS.creator}" />
																</p:column>
																<p:column  rendered="#{specialMaintenanceStationController.newmS.id != null}">
																	<p:inputText value="#{specialMaintenanceStationController.newmS.creator}" />
																</p:column>
															</p:row>
														</p:panelGrid>
														<p:dataList  rendered="#{!specialMaintenanceStationController.renderComparePanel}" value="#{specialMaintenanceStationController.dataList}" var="item"
															type="ordered">
 -->													        #{item.name}
													    </p:dataList>
														</div>
													</div>
											</div>
										</div>
									</p:dialog>
								 </h:form>
										
										
										
										
										<h:form id="confirmForm">
											<p:dialog id="confirmDialog" widgetVar="confirmDialog" modal="true" header="提示" width="450"
												height="200" closable="true">
									             	确认更新该特维设备吗？<br />
												<br />
												<br />
												<p:selectBooleanCheckbox value="#{specialMaintenanceStationController.overrideBreaker}"
													style="margin-right:5px;">
												</p:selectBooleanCheckbox>
												<h:outputText value="重新生成开关跳闸信息 " />
												<span style="color: red;">（重新生成会覆盖原有信息） </span>
												<br />
												<br />
												<p:commandButton value="确定" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"
													oncomplete="PF('confirmDialog').hide();getTableScrollHeight();"
													actionListener="#{specialMaintenanceStationController.updateMaintenanceEquLastFault}"
													update="form:dataTb :form:msgs" />
												<p:commandButton value="取消" styleClass="ui-confirmdialog-no" icon="ui-icon-close"
													oncomplete="PF('confirmDialog').hide();getTableScrollHeight();" update="form:dataTb :form:msgs" />
											</p:dialog>
										</h:form>
										<h:form id="overrideConfirmForm">
											<p:dialog id="overrideConfirmDialog" widgetVar="overrideConfirmDialog" modal="true" header="提示" width="450"
												height="200" closable="true">
									             	本次操作会覆盖掉所选厂站的特维信息，是否继续？<br />
												<br />
												<br />
												<br />
												<br />
												<p:commandButton value="确定" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"
													oncomplete="PF('overrideConfirmDialog').hide();getTableScrollHeight();"
													actionListener="#{specialMaintenanceStationController.substationSave}"
													update="form:dataTb :form:msgs stationForm:tree" />
												<p:commandButton value="取消" styleClass="ui-confirmdialog-no" icon="ui-icon-close"
													oncomplete="PF('overrideConfirmDialog').hide()" />
											</p:dialog>
										</h:form>
									</div>
							</div>
						<div id="pop" class="modal">
							<div class="modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal" aria-label="Close">
											<span aria-hidden="false">x</span>
										</button>
										<h4 id="popTitle" class="modal-title"></h4>
									</div>
									<div class="modal-body" style="height: 500px">
										<div id="popBody" class="col-sm-12">
											<div id="popChart" style="height: 450px"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				     <!-- 特维分析 -->
					<div class="chart tab-pane active" id="modelTraining" style="position: relative">
						<h:form id="modelTrainingForm">
							<div class="box box-solid with-border">
								<div class="box-header">
									<p:remoteCommand name="changeYearAnalysis" actionListener="#{specialMaintenanceAnalysisController.changeYear}"/>
									<p:outputLabel value="特维年份:" style="margin-left:3px;"/>
									<input type="text" id="yearAnalysis" onchange="chaneYearAnalysis()" style="width:60px;margin-left:5px;text-align:center"/>
									<p:commandButton icon="ui-icon-search" value="查询" onclick="closeDivClick();" actionListener="#{specialMaintenanceAnalysisController.query}"
										update="detailForm" style="margin-left:15px;"/>
								</div>
								<div class="panel-collapse collapse" id="selectDiv" style="margin-left:5px">
									<h:panelGrid columns="4" style="margin-top:8px;margin-bottom:10px" cellpadding="6">
										<p:outputLabel value="运维机构：" style="margin-left:5px;margin-bottom:5px;" />
										<p:autoComplete dropdown="true" id="maintenanceUnit_id"
											value="#{specialMaintenanceAnalysisController.queryMS.operationDepartment}"
											style="margin-right:10px;margin-bottom:5px;" size="18"
											scrollHeight="200" placeholder="输入拼音首字母查询"
											completeMethod="#{ledgerQueryDataController.completeMaintenanceUnit}">
										</p:autoComplete>
										
										<p:outputLabel value="运维分子公司:" style="margin-left:15px;margin-bottom:5px;"/>
										<p:autoComplete dropdown="true" id="companyName_id"
											value="#{specialMaintenanceAnalysisController.queryMS.companyName}"
											style="margin-right:10px;margin-bottom:5px;" size="18"
											scrollHeight="200" placeholder="输入拼音首字母查询"
											completeMethod="#{ledgerQueryDataController.completeMaintenanceUnit}">
										</p:autoComplete>
									</h:panelGrid>
									
									<h:panelGrid columns="6" style="margin-top:8px;margin-bottom:10px" cellpadding="6">
										<p:outputLabel value="是否安排停电计划:" style="margin-left:5px;margin-bottom:5px;"/>
										<h:selectOneMenu value="#{specialMaintenanceAnalysisController.cutPowerPlanQuery}"
											style="width:80px;height:28px;margin-left:5px;margin-bottom:5px;" id="cutPowerPlan">
											<f:selectItem itemLabel="" itemValue="" />
											<f:selectItem itemLabel="是" itemValue="1" />
											<f:selectItem itemLabel="否" itemValue="0" />
										</h:selectOneMenu>
										
										<p:outputLabel value="6.30前是否应该完成:" style="margin-left:15px;margin-bottom:5px;"/>
										<h:selectOneMenu value="#{specialMaintenanceAnalysisController.finishBeforeQuery}"
											style="width:80px;height:28px;margin-left:5px;margin-bottom:5px;" id="finishBefore">
											<f:selectItem itemLabel="" itemValue="" />
											<f:selectItem itemLabel="是" itemValue="1" />
											<f:selectItem itemLabel="否" itemValue="0" />
										</h:selectOneMenu>
										
										<p:outputLabel value="6.30前是否已完成:" style="margin-left:15px;margin-bottom:5px;"/>
										<h:selectOneMenu value="#{specialMaintenanceAnalysisController.finishQuery}"
											style="width:80px;height:28px;margin-left:5px;margin-bottom:5px;" id="finish">
											<f:selectItem itemLabel="" itemValue="" />
											<f:selectItem itemLabel="是" itemValue="1" />
											<f:selectItem itemLabel="否" itemValue="0" />
										</h:selectOneMenu>
									</h:panelGrid>
								</div>
							</div>
						</h:form>
						<h:form id="detailForm">
					      <p:panel id="panel" rendered="#{specialMaintenanceAnalysisController.finishedList4Vol.size()==0}" style="text-align:center">
					         <h:outputText value="暂无特维信息" />
					      </p:panel>
					      <p:outputPanel id="panelDetail" rendered="#{specialMaintenanceAnalysisController.finishedList4Vol.size()>0}">
						      <p:repeat var="detail" value="#{specialMaintenanceAnalysisController.finishedList4Vol}">
						         <div class="box box-solid">
								   <div class="box-body">
									 <div class="row">
										<div class='col-sm-12'>
											<div class='info-box' style="border: 1px solid #00c0ef;">
												<span class='info-box-icon bg-aqua'> <h:outputText value="#{detail.voltage}kV"/>
												</span> 
												<div class='info-box-content'>
												   <div class='col-sm-2  border-right'>
												      <div class='description-block'>
												        <p>特维厂站总数</p>
												        <p class="text-yellow"> 
												           <h:outputText value="#{detail.spStations.size()}"/>
												        </p>
												      </div>
												   </div>
												   <div class='col-sm-1  border-right'>
												      <div class='description-block'>
												        <p>已完成</p>
												        <p class="text-green"> 
												           <h:outputText value="#{detail.spStations.size()-detail.unfinishedStations.size()}"/>
												        </p>
												      </div>
												   </div>
												   <div class='col-sm-1  border-right'>
												      <div class='description-block'>
												        <p>未完成</p>
												        <p class="text-red"> 
												           <h:outputText value="#{detail.unfinishedStations.size()}"/>
												        </p>
												      </div>
												   </div>
												   <div class='col-sm-2  border-right'>
												      <div class='description-block'>
												        <p>特维间隔总数</p>
												        <p class="text-yellow"> 
												           <h:outputText value="#{detail.spBlanks.size()}"/>
												        </p>
												      </div>
												   </div>
												   <div class='col-sm-1  border-right'>
												      <div class='description-block'>
												        <p>已完成</p>
												        <p class="text-green"> 
												           <h:outputText value="#{detail.totalDetail.finishedBlanks.size()}"/>
												        </p>
												      </div>
												   </div>
												   <div class='col-sm-2  border-right'>
												      <div class='description-block'>
												        <p>未到计划停电日期</p>
												        <p class="text-light-blue"> 
												           <h:outputText value="#{detail.totalDetail.unReachedPlanBlanks.size()}"/>
												        </p>
												      </div>
												   </div>
												   <div class='col-sm-2  border-right'>
												      <div class='description-block'>
												        <p>已超计划停电日期</p>
												        <p class="text-red"> 
												           <h:outputText value="#{detail.totalDetail.overPlanBlanks.size()}"/>
												        </p>
												      </div>
												   </div>
												   <div class='col-sm-1  border-right'>
												      <div class='description-block'>
												        <p>完成率</p>
												        <p class="text-green"> 
												           <h:outputText value="#{detail.totalDetail.finishRate}">
												             <f:convertNumber pattern="#0.00%"/>
												           </h:outputText>
												        </p>
												      </div>
												   </div>
												</div>
											</div>
										</div>
									</div>
								     <p:dataTable id="unfinishedTb" var="item" emptyMessage="暂无数据" value="#{detail.unfishedList}">
								         <f:facet name="header">
					            			未完成基本情况
					        			</f:facet>
					        			 <p:column headerText="调管范围" style="text-align:center">
				        					<h:outputText value="#{item.transMechanism}" />
				    					</p:column>
					        			<p:column headerText="完成数" style="text-align:center">
				        					<h:outputText value="#{item.finishedBlanks.size()}" />
				    					</p:column>
					        			<p:column headerText="未到计划停电日期" style="text-align:center">
				        					<h:outputText value="#{item.unReachedPlanBlanks.size()}" />
				    					</p:column>
					        			<p:column  headerText="已超计划停电日期" style="text-align:center">
				        					<h:outputText value="#{item.overPlanBlanks.size()}" />
				    					</p:column>
					        			<p:column headerText="小计" style="text-align:center">
				        					<h:outputText value="#{item.unfinishedBlanks.size()}" />
				    					</p:column>
					        			<p:column  headerText="完成率" style="text-align:center">
					        			    <h:outputText value="--" style="color:black" rendered="#{item.unfinishedBlanks.size() == 0}">
				        					</h:outputText>
				        					<h:outputText value="#{item.finishRate}" style="color:red" rendered="#{item.finishRate lt 0.6  &amp;&amp; item.finishRate ge 0}">
				        					  <f:convertNumber pattern="#0.00%"/>
				        					</h:outputText>
				        					<h:outputText value="#{item.finishRate}" style="color:blue" rendered="#{item.finishRate ge 0.6 &amp;&amp; item.finishRate lt 1}">
				        					  <f:convertNumber pattern="#0.00%"/>
				        					</h:outputText>
				        					<h:outputText value="#{item.finishRate}"  style="color:green" rendered="#{item.finishRate == 1 &amp;&amp;  item.unfinishedBlanks.size() != 0}">
				        					   <f:convertNumber pattern="#0.00%"/>
				        					</h:outputText>
				    					</p:column>
				    					<p:column style="width:40px;text-align: center;padding:2px" >
								             <p:commandButton update="unfinishedInfoDlgForm" icon="ui-icon-search" oncomplete="showDlg()"
								                  title="#{item.transMechanism}" actionListener="#{specialMaintenanceAnalysisController.getMaintenanceInfo(item)}">
								            </p:commandButton>
								        </p:column>
								     </p:dataTable>
								  </div>
							    </div>
						      </p:repeat>
					      </p:outputPanel>
					   </h:form>
					    <h:form id="unfinishedInfoDlgForm" style="display:none">
						      	<div class="col-sm-12">
							      	<div class="col-sm-2">
							      	     <div class="box">
							    	        <div class="box-header">
							    	        	<h3 class="box-title">特维厂站</h3>
							    	        </div>
							    	        <div class="box-body">
							    	           <p:tree value="#{specialMaintenanceAnalysisController.root}" var="node" dynamic="true" selectionMode="single"
						                            selection="#{specialMaintenanceAnalysisController.selectedNode}">
						                            <p:ajax event="select" update="unfinishedInfoDlgForm:blanksTb" listener="#{specialMaintenanceAnalysisController.onNodeSelect}" />
											        <p:treeNode type="finishedRoot" icon="fa fa-home">
														<h:outputText value="#{node}" style="color:green"/>
													</p:treeNode>
											        <p:treeNode type="unfinishedRoot" icon="fa fa-home">
														<h:outputText value="#{node}" style="color:red"/>
													</p:treeNode>
											    </p:tree>
							    	        </div>
						    	   		 </div>
							      	</div>
							      	<div class="col-sm-10">
							      	  <div class="box">
						    	        <div class="box-header">
						    	        	<h3 class="box-title">特维间隔</h3>
						    	        </div>
						    	        <div class="box-body">
						    	        	<p:dataTable id="blanksTb" var="blank" emptyMessage="暂无数据" value="#{specialMaintenanceAnalysisController.blankInfos}" 
									      	     rowIndexVar="ite" >
								      	        <p:column style="width:16px;">
							            			<p:rowToggler />
										        </p:column>
											    <p:column width="60" headerText="序号" style="text-align:center">
													<h:outputText value="#{ite+1}" />
												</p:column>
												<p:column headerText="间隔名称" style="text-align:center">
								      	           <h:outputText value="#{blank.blank.blankName}" />
								      	        </p:column>
								      	        <p:column headerText="运维分子公司名称" style="text-align:center">
									      	           <h:outputText value="#{blank.blank.companyName}" />
								      	        </p:column>
												<p:column headerText="运维单位" style="text-align:center">
								      	           <h:outputText value="#{blank.blank.operationDepartment}" />
								      	        </p:column>
												<p:column headerText="是否安排了停电计划" style="text-align:center">
								      	           <h:outputText value="#{blank.blank.cutPowerPlan==true?'是':'否'}" />
								      	        </p:column>
								      	        <p:column headerText="传动计划时间" style="text-align:center">
								      	           <h:outputText value="#{blank.blank.chuandongTime}" rendered="#{null!=blank.blank.chuandongTime}">
								      	            	<f:convertDateTime pattern="yyyy-MM-dd"></f:convertDateTime>
								      	           </h:outputText>
								      	           <h:outputText value="无停电计划" rendered="#{null==blank.blank.chuandongTime}"/>
								      	        </p:column>
								      	        <p:column headerText="是否已经完成传动" style="text-align:center">
								      	        	<h:outputText value="是" style="color:green"   rendered="#{blank.blank.finish==true}"/>
								      	        	<h:outputText value="否" style="color:red"   rendered="#{blank.blank.finish==false}"/>
								      	        </p:column>
								      	        <p:column headerText="实际完成传动时间" style="text-align:center">
								      	           <h:outputText value="#{blank.blank.finishedTime}" >
								      	              <f:convertDateTime pattern="yyyy-MM-dd"></f:convertDateTime>
								      	           </h:outputText>
								      	        </p:column>
								      	        <p:rowExpansion>
								      	            <p:dataTable id="breakersTb" var="breaker" emptyMessage="暂无数据" value="#{blank.breakers}" rowIndexVar="ite" style="width:70%">
										      	         <p:column headerText="断路器" style="text-align:center">
										      	           <h:outputText value="#{breaker.name}" />
										      	        </p:column>
										      	         <p:column headerText="A相" style="text-align:center">
										      	         <h:outputText value="#{breaker.lastTripATime}">
						                                   	<f:convertDateTime pattern="yyyy-MM-dd" />
						                                 </h:outputText>
										      	        </p:column>
										      	         <p:column headerText="B相" style="text-align:center">
										      	           <h:outputText value="#{breaker.lastTripBTime}" >
										      	           	<f:convertDateTime pattern="yyyy-MM-dd" />
										      	           	</h:outputText>
										      	        </p:column>
										      	         <p:column headerText="C相" style="text-align:center">
										      	           <h:outputText value="#{breaker.lastTripCTime}" >
										      	           	<f:convertDateTime pattern="yyyy-MM-dd" />
										      	           	</h:outputText>
										      	        </p:column>
										      	     </p:dataTable>
								      	        </p:rowExpansion>
											</p:dataTable>
						    	        </div>
						    	      </div>
							       </div>
						      	</div>
					     <h:inputHidden id="selectedTransMechanism" value="#{specialMaintenanceAnalysisController.selectedItem.transMechanism}"></h:inputHidden>
					     <h:inputHidden id="selectedYear" value="#{specialMaintenanceAnalysisController.selectedItem.year}"></h:inputHidden>
					     <h:inputHidden id="selectedVol" value="#{specialMaintenanceAnalysisController.selectedItem.voltage}"></h:inputHidden>
					   </h:form>
					</div>
				</div>
			</div>
		
		</div>
	</ui:define>

	<ui:define name="contentend">
		<script src="spStationMaintain.js"></script>
		<script src="#{request.contextPath}/resources/js/mymodal.js"></script>
		<script src="#{request.contextPath}/resources/plugins/echarts/echarts.js"></script>
		<script src="#{request.contextPath}/resources/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/pieChart.js"></script>
		<script>
		
		  function showDlg(){
			  var transMechanism=document.getElementById("unfinishedInfoDlgForm:selectedTransMechanism").value=='合计'?"":document.getElementById("unfinishedInfoDlgForm:selectedTransMechanism").value;
			  var selectedYear=document.getElementById("unfinishedInfoDlgForm:selectedYear").value;
			  var selectedVol=document.getElementById("unfinishedInfoDlgForm:selectedVol").value;
			  layer.open({
		        type: 1,
		        title: [transMechanism+selectedYear+"年"+selectedVol+"kV传动计划及执行情况","font-size:18px;"], 
		        closeBtn: 1,
		        maxmin : true,
		        area: ['1200px', '700px'],
		        shade: 0.5,
		        id: 'LAY_Detail', //设定一个id，防止重复弹出
		        moveType: 1, //拖拽模式，0或者1
		        content: $('#unfinishedInfoDlgForm')
		      });
		  }
			function onSelectDivClick() {
				var div = $('#selectDiv');
				if (div.hasClass('in')) {
					div.collapse('hide');
					$('#selectButtonIcon').removeClass("fa fa-caret-up");
					$('#selectButtonIcon').addClass("fa fa-caret-down");
				} else {
					div.collapse('show');
					$('#selectButtonIcon').removeClass("fa fa-caret-down");
					$('#selectButtonIcon').addClass("fa fa-caret-up");
				}
			}
			function closeDivClick() {
				var div = $('#selectDiv');
				div.collapse('hide');
				$('#selectButtonIcon').removeClass("fa fa-caret-up");
				$('#selectButtonIcon').addClass("fa fa-caret-down");
			}
	
			function resetQuery() {
				closeDivClick();
				var d = new Date();
				var year=d.getFullYear();
				$("#yearAnalysis").val(year);
			}
		</script>
	</ui:define>
</ui:composition>
